package util.math;

import java.math.BigDecimal;
import java.util.List;

public class MathHelp {
	
	public String timeHash(List<Double> timeList) {
		String hashString = "";
		for (Double time : timeList) {
			if (time > 0 || time == 0){
				hashString += "~" + getHash(getDecimal(time)) ;
			} else {
				hashString += "~" + (-getHash(getDecimal(-time))-1);
			}
		}
		return hashString.substring(1);
	}
	
	public double getDecimal (double temp) {
		double time;
		BigDecimal bd;
		if (Double.isNaN(temp)) {
			return 0.0;
		}
			time = temp/10;
			bd = new BigDecimal(time);
			time = bd.setScale(1, BigDecimal.ROUND_DOWN).doubleValue();

		
		return time;
	}
	
	
	
	public int getHash(double time) {
		int hash = (int) Math.floor(time);
		return hash;
	}
	
	

}
